package com.tanhua.dubbo.api.db;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.tanhua.domain.db.QuizTemplate;
import com.tanhua.dubbo.mapper.QuizTemplateMapper;
import org.apache.dubbo.config.annotation.Service;
import org.springframework.beans.factory.annotation.Autowired;


/**
 * @Author Administrator
 * @Date 2021/8/24  20:19
 */
@Service
public class QuizTemplateApiImpl implements QuizTemplateApi {

    @Autowired
    private QuizTemplateMapper quizTemplateMapper;

    /**
     * 根据分数查询模板
     * @param score
     * @return
     */
    @Override
    public QuizTemplate qrueyTemplateByscore(int score) {
        QueryWrapper<QuizTemplate> templateQueryWrapper = new QueryWrapper<>();
        templateQueryWrapper.le("lower_score",score).ge("higher_socre",score);
        QuizTemplate quizTemplate = quizTemplateMapper.selectOne(templateQueryWrapper);
        return quizTemplate;
    }
}
